<?php
//inculde即可以使用data数据。本页所有的data数据，倾在controller都处理好
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");
//引入系统设置
include_once("../../../common/model/setting.php");
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'case'");
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
?>



<?php
$new_detail_nid=$_GET['nid'];


//首先看看，这个项目有无财务信息。财务信息需要删除了才能继续删除项目。
$table_suffix="finance";
$table=$table_Prefix.$table_suffix;
$_finance_in_case=select_one_line_all_items($table,"caseid = '".$_GET['nid']."'");

if($_finance_in_case['nid']<=0)
{

    //设置需要搜索的表格的前缀后缀
    $table_suffix="case";
    $table=$table_Prefix.$table_suffix;
//设置需要搜索的表格的前缀后缀


    $sql = "DELETE FROM $table WHERE nid=$new_detail_nid";
    $query=mysql_query($sql) or die  ("error:".mysql_error());




//同时还要删除这个项目的提成数据
    $table_suffix="bonus_record";
    $table=$table_Prefix.$table_suffix;
    $sql = " DELETE FROM $table WHERE caseid=$new_detail_nid and utoken = '".$_SESSION['utoken']."'";
    $query=mysql_query($sql) or die  ("error:".mysql_error());
    mysql_close($con);



    echo 1;//表示成功
}
else
{
    echo "项目含未删除财务信息。";
}




?>


